#!/bin/bash

echo "Open TCP port 1234 in the firewall"
iptables -t nat -I PREROUTING -p tcp --dport 1234 -m state --state NEW -j ACCEPT

echo "Update the package index and install Git"
yum install -y git

echo "Configure global Git settings"
git config --global user.name 'you name' 
git config --global user.email 'you email'

echo "Install Python 3"
yum -y install python3

echo "Clone the xnote repository from Gitee"
git clone https://gitee.com/wangyinping/open-source-cloud-deployment.git

echo "Change directory to the cloned repository"
cd open-source-cloud-deployment

echo "Copy the configuration file"
cp config/boot/boot.min.properties boot.local.properties

echo "Run the application in the background"
nohup python3 app.py --config boot.local.properties &

# Print a message indicating completion
echo "Script completed."